/** \file FilterFactory.h 
    \author belot.nicolas
	Create a new Filter
*/

#ifndef FILTERFACTORY_H
#define FILTERFACTORY_H 1

#include "Filter.h"
#include <map>
namespace libtrckr {

typedef Filter* create_t(const char*);
typedef void	destroy_t(Filter *);

class FilterFactory {
/** \class libtrckr::FilterFactory
	\brief A filter factory
	A factory to get new Filter (Filter*)
*/
	public :
/*	enum filter_t {
	FILTER, 
	FILTERTRANSFERT,
	FILTERDFT, 
	FILTERCONVOLUTION, 
	FILTERLP, 
	FILTERHP, 
	FILTEREQUALIZER,
	FILTERCOMPRESSOR
	};*/
	/** Create a map with all plugins in the directorys listed in dirs
		\param path Path with plugins
		\param size Size of the array \var path
	*/
	static int init(string[],int);
	/** Loads a new filter from a file 
	\param  classe Name of the Filter
	*/
	static Filter* loadNewFilter(string);
	/** Delete a filter and free ressources used by 
	\param f  the Filter */
	static void deleteFilter(Filter *);
	/** Free all ressources used by the factory */
	static void close();
	private:
	static void** handles;
	struct plugin {
		create_t *cfunc;
		destroy_t *dfunc;
	};
	static map<string,plugin> byName;
	static map<Filter*,plugin> byInstance;
};
/** Usefull function for FilterFactory*/
Filter* createNewFilter(string);
/** Usefull function for FilterFactory*/
void DestroyFilter(Filter *);
}
#endif

